package cn.zn.modules.budget.cur.entity;

import cn.zn.framework.common.abs.AbsOldMainEntity;
import cn.zn.framework.common.vo.FinanceValues;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.math.BigDecimal;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "t_budget_info_detail_attach")
public class TBudgetInfoDetailAttach extends AbsOldMainEntity {

    @TableField(value = "CONTENT_TYPE_")
    private String contentType;

    @TableField(value = "DESC_")
    private String desc;

    @TableField(value = "GENERATE_NAME_")
    private String generateName;

    @TableField(value = "PATH_LOCAL_")
    private String pathLocal;

    @TableField(value = "PATH_RELATIVE_")
    private String pathRelative;

    @TableField(value = "REAL_NAME_")
    private String realName;

    @TableField(value = "SIZE_")
    private Long size;

    @TableField(value = "SUFFIX_")
    private String suffix;

    @TableField(value = "T_BUDGET_INFO_DETAIL_ID_")
    private String tBudgetInfoDetailId;

    @TableField(value = "IS_MAIN_")
    private Boolean isMain;

    public String getThumbnailPath() {
        if (pathRelative.lastIndexOf(".") != -1) {
            return pathRelative.substring(0, pathRelative.lastIndexOf(".")).concat("_thumbnail").concat(pathRelative.substring(pathRelative.lastIndexOf(".")));
        } else {
            return pathRelative.concat("_thumbnail");
        }
    }
}